
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 10/30/2012 23:55:09
-- Generated from EDMX file: c:\users\tokic\documents\visual studio 2012\Projects\MvcApplication1\MvcApplication1\Models\Model1.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [mila];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------


-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'AutorSet'
CREATE TABLE [dbo].[AutorSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [ime] nvarchar(max)  NOT NULL,
    [prezime] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'KnjigeSet'
CREATE TABLE [dbo].[KnjigeSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [naslov] nvarchar(max)  NOT NULL,
    [brstranica] nvarchar(max)  NOT NULL,
    [Autor_Id] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'AutorSet'
ALTER TABLE [dbo].[AutorSet]
ADD CONSTRAINT [PK_AutorSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'KnjigeSet'
ALTER TABLE [dbo].[KnjigeSet]
ADD CONSTRAINT [PK_KnjigeSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [Autor_Id] in table 'KnjigeSet'
ALTER TABLE [dbo].[KnjigeSet]
ADD CONSTRAINT [FK_AutorKnjige]
    FOREIGN KEY ([Autor_Id])
    REFERENCES [dbo].[AutorSet]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_AutorKnjige'
CREATE INDEX [IX_FK_AutorKnjige]
ON [dbo].[KnjigeSet]
    ([Autor_Id]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------